﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using SwenAssigment.Classes;
namespace SwenAssigment
{
    public partial class GuestNew : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //
        }

        protected void Button3_Click(object sender, EventArgs e)
        {
            try
            {
                RADcon con = new RADcon();
                Guest g = new Guest();
                g.fname = TextBox1.Text;
                g.lname = TextBox2.Text;
                g.contact = int.Parse(TextBox3.Text);
                g.email = TextBox4.Text;
                g.address = TextBox5.Text;
                g.ic = TextBox6.Text;
                bool b = con.gcreate(g);
                if (b == true)
                {
                    Session["mystat"] = "Guest Created";
                    Response.Redirect("GuestExist.aspx");
                }
                else
                {
                    Label1.Visible = true;
                }
            }
            catch
            {
                Label1.Visible = true;
            }
        }
    }
}